import java.util.*;

public class Example {
    public static void main(String args[]) {
        Random r = new Random();
        int lhs = r.nextInt(10000);
        int rhs = r.nextInt(10000);
        int stdAns = lhs * rhs;
        System.out.println("What is " + lhs + " * " + rhs + "?");
        ArrayList<Integer> answers = new ArrayList<>();
        Scanner in = new Scanner(System.in);
        int userAns = in.nextInt();
        while (userAns != stdAns) {
            if (answers.contains(userAns))
                System.out.println("You have already entered " + userAns + ". Please try again.");
            else {
                answers.add(userAns);
                System.out.println("Wrong answer, please try again.");
            }
            System.out.println("What is " + lhs + " * " + rhs + "?");
            userAns = in.nextInt();
        }
        System.out.println("You got it!");
    }
}